Python 3.x Python ord()和chr() | 您所在的位置:网站首页 › java ord › Python 3.x Python ord()和chr() |
Python 3.x Python ord()和chr(),python-3.x,list,for-loop,chr,ord,Python 3.x,List,For Loop,Chr,Ord,我有: 根据我的理解,这应该只输出句子中的每个字母,如: txt = input('What is your sentence? ') list = [0]*128 for x in txt: list[ord(x)] += 1 for x in list: if x >= 1: print(chr(list.index(x)) * x) 对于字符串“aB)a2a2a2”),输出是正确的: )) 111 3333 etc. 对于字符串 |
CopyRight 2018-2019 实验室设备网 版权所有 |